﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="备件计划管理.aspx.cs" Inherits="syc.Jidong.备件计划管理" %>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript" language="javascript" src="/common.js"></script>
<form id="form1" runat="server">
<asp:Label ID="SelectedID" runat="server" Text="" Visible="false"></asp:Label>
<asp:Label ID="BillID" runat="server" Text="" Visible="false"></asp:Label>
<asp:Label ID="SqlText" runat="server" Text="" Visible="false"></asp:Label>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>"
onselected="SqlDataSource1_Selected"
 UpdateCommand="update 备件计划 set 计划数量=@计划数量,单价=@单价,供货单位=@供货单位 where ID=@ID"
 >
 <UpdateParameters>
  <asp:ControlParameter ControlID="GongHuo1" Name="供货单位"  PropertyName="SelectedValue"/>  
</UpdateParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" 
    ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
    SelectCommand="SELECT rtrim(编码) as 编码, rtrim(编码)+':' + 名称 as 名称 FROM 设备编码 where 资产=0 and 编码 like '35%' order by 编码"></asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource3" runat="server" 
    ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
    SelectCommand="select 0 as ID,'' as 名称 union SELECT ID,名称 from 材料供货单位 where [名称] != '一分厂' and [名称] != '二分厂' and [名称] != '三分厂' and [名称] != '五分厂'">
    
</asp:SqlDataSource>
<div id="wintop" class="wintop">备品备件采购计划管理</div>

<asp:Panel ID="Panel1" runat="server" CssClass="panel">
    <input type="button" value="录 入" class="button" onclick="parent.swin_load('/JiDong/备件计划录入.aspx');"/>
    
    <asp:Button ID="Button_Edit" runat="server" Text="修 改" CssClass="button"
        UseSubmitBehavior="False" Enabled="false" />
        
    <asp:Button ID="Button_Delete" runat="server" Text="删 除" CssClass="button"  
        UseSubmitBehavior="False" Enabled="false"
        OnClientClick="if(!confirm('确认要删除该条记录吗？'))return(false);" 
        onclick="Button_Delete_Click"  />
</asp:Panel>

<asp:Panel ID="Panel2" runat="server" CssClass="panel" GroupingText="备品备件采购填报记录 查询">

</span>计划年度：<asp:DropDownList ID="NianDu" runat="server" Width="105">
    <asp:ListItem Value="0">全部</asp:ListItem>
    <asp:ListItem Value="2008">2008</asp:ListItem>
    <asp:ListItem Value="2009">2009</asp:ListItem>
    <asp:ListItem Value="2010">2010</asp:ListItem>
    <asp:ListItem Value="2011">2011</asp:ListItem>
    <asp:ListItem Value="2012">2012</asp:ListItem>
    <asp:ListItem Value="2013">2013</asp:ListItem>
    <asp:ListItem Value="2014">2014</asp:ListItem>
    <asp:ListItem Value="2015">2015</asp:ListItem>
    <asp:ListItem Value="2016">2016</asp:ListItem>
    <asp:ListItem Value="2017">2017</asp:ListItem>
    <asp:ListItem Value="2018">2018</asp:ListItem>
    <asp:ListItem Value="2019">2019</asp:ListItem>
    <asp:ListItem Value="2020">2020</asp:ListItem>
    </asp:DropDownList>
<span style="margin-left:5px;"></span>月份：<asp:DropDownList ID="YueFen" runat="server" Width="88">
    <asp:ListItem Value="0">全部</asp:ListItem>
    <asp:ListItem Value="1">1</asp:ListItem>
    <asp:ListItem Value="2">2</asp:ListItem>
    <asp:ListItem Value="3">3</asp:ListItem>
    <asp:ListItem Value="4">4</asp:ListItem>
    <asp:ListItem Value="5">5</asp:ListItem>
    <asp:ListItem Value="6">6</asp:ListItem>
    <asp:ListItem Value="7">7</asp:ListItem>
    <asp:ListItem Value="8">8</asp:ListItem>
    <asp:ListItem Value="9">9</asp:ListItem>
    <asp:ListItem Value="10">10</asp:ListItem>
    <asp:ListItem Value="11">11</asp:ListItem>
    <asp:ListItem Value="12">12</asp:ListItem>
    </asp:DropDownList>
 <asp:DropDownList ID="GongHuo1" runat="server" Width="80px" 
                                    DataSourceID="SqlDataSource3" 
        DataTextField='名称' DataValueField="名称" >
                                </asp:DropDownList>       
<span style="margin-left:20px;">
填报单位：<asp:DropDownList ID="TianBao" runat="server" DataSourceID="SqlDataSource2" Width="276"
        DataTextField="名称" DataValueField="编码">
    </asp:DropDownList>
    
<p style="font-size:8px;margin:0px;line-height:8px;">&nbsp;</p>
填报日期：<asp:TextBox ID="Date1" runat="server" CssClass="textbox" Width="105px"></asp:TextBox><img alt="" src="/Icons/29.png" align="middle" onclick="makecalendar(document.getElementById('Date1').value, document.getElementById('Date1'));" />
至<asp:TextBox ID="Date2" runat="server" CssClass="textbox" Width="105px"></asp:TextBox><img alt="" src="/Icons/29.png" align="middle" onclick="makecalendar(document.getElementById('Date2').value, document.getElementById('Date2'));" />

<span style="margin-left:32px;"></span>品名：<asp:TextBox ID="PinMing" runat="server" CssClass="textbox" Width="110px"></asp:TextBox>
<span style="margin-left:10px;"></span>用途：<asp:TextBox ID="YongTu" runat="server" CssClass="textbox" Width="110px"></asp:TextBox>
<span style="margin-left:10px;"></span>
<asp:Button ID="Button_Query" runat="server" Text="查 询" UseSubmitBehavior="false" 
        CssClass="mbutton" onclick="Button_Query_Click" />

<asp:Button ID="Button_Export" runat="server" Text="导出采购计划表" UseSubmitBehavior="false" 
        CssClass="mbutton2" onclick="Button_Export_Click" />
 <asp:Button ID="Button_Clear" runat="server" Text="清空条件" UseSubmitBehavior="false" 
    CssClass="mbutton" onclick="Button_Clear_Click" />   
</asp:Panel>
<asp:Panel ID="Panel_Msg" runat="server" CssClass="panel2" Visible="false">
    <asp:Label ID="Message" runat="server" Text="" CssClass="prompt"></asp:Label>
</asp:Panel>

<div class="gridframe">
<div class="gridview">

    <table border="1" width="100%" cellspacing="0" cellpadding="0" bordercolor="#e5cfab">
        <tr>
            <td class="grid-title">备品备件采购填报记录</td>
        </tr>
        <tr>
            <td class="grid-back">
                <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                    AutoGenerateColumns="False" CssClass="grid" DataKeyNames="ID,MID" 
                    DataSourceID="SqlDataSource1"
                    PageSize="15"
                    GridLines="None" ondatabound="GridView1_DataBound" 
                    onpageindexchanged="GridView1_PageIndexChanged" AllowSorting="True" 
                    UseAccessibleHeader="False" onrowediting="GridView1_RowEditing" 
                    onrowcreated="GridView1_RowCreated">
                    <PagerSettings Visible="False" />
                    <RowStyle CssClass="grid-row-normal" />
                    <Columns>
                    
                        <asp:TemplateField HeaderText="">
                            <ItemTemplate>
                                <asp:Button ID="Button_xz" runat="server" CommandName="Edit" Text="" CssClass="hide"/>
                                <img src="/Icons/online.gif" style="margin-top:2px;" alt="" />
                            </ItemTemplate>
                            <HeaderStyle CssClass="grid-header" />
                            <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="30px" />
                        </asp:TemplateField>
                         
                        <asp:TemplateField HeaderText="计划" SortExpression="计划">
                            <ItemTemplate>
                                <asp:Label ID="Label_jh" runat="server" Text='<%# Eval("计划") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle CssClass="grid-header" />
                            <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="45px" />
                        </asp:TemplateField>
                                           
                        <asp:TemplateField HeaderText="品名" SortExpression="品名">
                            <ItemTemplate>
                                <asp:Label ID="Label_ph" runat="server" Text='<%# Eval("品名") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle CssClass="grid-header" />
                            <ItemStyle CssClass="grid" HorizontalAlign="Left" Width="100px" />
                        </asp:TemplateField>

                        <asp:TemplateField HeaderText="规格/型号">
                            <ItemTemplate>
                                <asp:Label ID="Label_gg" runat="server" Text='<%# Eval("规格") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle CssClass="grid-header" />
                            <ItemStyle CssClass="grid" HorizontalAlign="Left" Width="90px" />
                        </asp:TemplateField>
                        
                        <asp:TemplateField HeaderText="单位">
                            <ItemTemplate>
                                <asp:Label ID="Label_dw" runat="server" Text='<%# Eval("单位") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle CssClass="grid-header" />
                            <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="40px" />
                        </asp:TemplateField>
                        
                        <asp:TemplateField HeaderText="填报数量">
                            <ItemTemplate>
                                <asp:Label ID="Label_tbsl" runat="server" Text='<%# Eval("填报数量") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle CssClass="grid-header" />
                            <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="60px" />
                        </asp:TemplateField>
                        
                        <asp:TemplateField HeaderText="计划数量">
                            <ItemTemplate>
                                <asp:Label ID="Label_jhsl" runat="server" Text='<%# Eval("计划数量") %>'></asp:Label>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox ID="TextBox_jhsl" runat="server" Text='<%# Bind("计划数量") %>' Width="100%" CssClass="textbox"></asp:TextBox>
                            </EditItemTemplate>
                            <HeaderStyle CssClass="grid-header" />
                            <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="60px" />
                        </asp:TemplateField>
                        
                        <asp:TemplateField HeaderText="单价(元)">
                            <ItemTemplate>
                                <asp:Label ID="Label_dj" runat="server" Text='<%# Eval("单价") %>'></asp:Label>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox ID="TextBox_dj" runat="server" Text='<%# Bind("单价") %>' Width="100%" CssClass="textbox"></asp:TextBox>
                            </EditItemTemplate>
                            <HeaderStyle CssClass="grid-header" />
                            <ItemStyle CssClass="grid" HorizontalAlign="Right" Width="60px" />
                        </asp:TemplateField>
                        
                        <asp:TemplateField HeaderText="金额(元)">
                            <ItemTemplate>
                                <asp:Label ID="Label_je" runat="server" Text='<%# (decimal)Eval("单价")*(int)Eval("计划数量") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle CssClass="grid-header" />
                            <ItemStyle CssClass="grid" HorizontalAlign="Right" Width="70px" />
                        </asp:TemplateField>
                        
                        <asp:TemplateField HeaderText="填报单位">
                            <ItemTemplate>
                                <asp:Label ID="Label_tb" runat="server" Text='<%# Eval("填报单位") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle CssClass="grid-header" />
                            <ItemStyle CssClass="grid" HorizontalAlign="Left" Width="70px" />
                        </asp:TemplateField>
                        
                        <asp:TemplateField HeaderText="填报日期" SortExpression="填报日期">
                            <ItemTemplate>
                                <asp:Label ID="Label_rq" runat="server" Text='<%# Eval("填报日期","{0:d}") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle CssClass="grid-header" />
                            <ItemStyle CssClass="grid" HorizontalAlign="center" Width="60px" />
                        </asp:TemplateField>
                        
                        <asp:TemplateField HeaderText="用途">
                            <ItemTemplate>
                                <asp:Label ID="Label_yt" runat="server" Text='<%# Eval("用途") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle CssClass="grid-header" />
                            <ItemStyle CssClass="grid" HorizontalAlign="Left" Width="80px" />
                        </asp:TemplateField>                        
                        
                           <asp:TemplateField HeaderText="供货商">                        
                            <ItemTemplate>
                                <asp:Label ID="Label_gh" runat="server" Text='<%# Eval("供货单位") %>'></asp:Label>
                            </ItemTemplate>
                             <EditItemTemplate>                                
                                <asp:DropDownList ID="GongHuo" runat="server" Width="80px"  AutoPostBack="true"
                                    DataSourceID="SqlDataSource3" DataTextField='名称' DataValueField="名称" 
                                     onselectedindexchanged="GongHuo_SelectedIndexChanged" >
                                </asp:DropDownList>                                
                            </EditItemTemplate>
                            <HeaderStyle CssClass="grid-header" />
                            <ItemStyle CssClass="grid" HorizontalAlign="Left" Width="80px" />
                        </asp:TemplateField>
                        
                        <asp:TemplateField HeaderText="操作" >
                            <ItemTemplate>

                           </ItemTemplate>
                            <EditItemTemplate>
                                <asp:Button ID="Button_GX" runat="server" CommandName="Update" Text="更 新" CssClass="smallbutton" UseSubmitBehavior="true"/>
                            </EditItemTemplate>
                            <HeaderStyle CssClass="grid-header" />
                            <ItemStyle CssClass="grid" HorizontalAlign="center" Width="50px" />
                        </asp:TemplateField>
                         <asp:TemplateField HeaderText="是否到货" ItemStyle-CssClass="grid" HeaderStyle-CssClass="grid-header"
                                    ItemStyle-HorizontalAlign="center" ItemStyle-Width="80" >
                                    <ItemTemplate>                                                                           
                                        <asp:CheckBox ID="CheckBox1" runat="server"  Checked='<%# Bind("是否到货") %>' ToolTip='<%# Eval("ID") %>'  oncheckedchanged="CheckBox1_CheckedChanged" AutoPostBack="True"
                                             ></asp:CheckBox>
                                    </ItemTemplate>

<HeaderStyle CssClass="grid-header"></HeaderStyle>
                                   <ItemStyle HorizontalAlign="Center" CssClass="grid" Width="60px"></ItemStyle>
                                </asp:TemplateField>
                         <asp:TemplateField HeaderText="到货日期" SortExpression="到货日期">
                            <ItemTemplate>
                                <asp:Label ID="Label_dhrq" runat="server" Text='<%# Eval("到货日期","{0:d}") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle CssClass="grid-header" />
                            <ItemStyle CssClass="grid" HorizontalAlign="center" Width="60px" />
                        </asp:TemplateField>
                    </Columns>
                    <SelectedRowStyle CssClass="grid-row-selected" />
                  </asp:GridView>
            </td>
        </tr>
        <tr>
            <td>   
                <table width="100%">
                    <tr>
                        <td class="pagebar">
                            <asp:Button ID="Button_Pager_First" UseSubmitBehavior="false" runat="server" Text="" ToolTip="首页" 
                                CssClass="pageturn-first-b" onclick="Pager_Click" CommandName="--" />
                            <asp:Button ID="Button_Pager_Prev" UseSubmitBehavior="false" runat="server" Text="" ToolTip="上一页" 
                                CssClass="pageturn-prev-b" onclick="Pager_Click" CommandName="-" />
                            <input type="button" class="page-split" UseSubmitBehavior="false" disabled />第<asp:TextBox 
                                ID="TextBox_Pager" AutoPostBack="True" runat="server" CssClass="pageturn" 
                                ontextchanged="Pager_Click"></asp:TextBox>页<input type="button" class="page-split" disabled /><asp:Label ID="Label_Pages" UseSubmitBehavior="false" runat="server"></asp:Label><input type="button" class="page-split" disabled />
                            
                            <asp:Button ID="Button_Pager_Next" UseSubmitBehavior="false" runat="server" Text="" ToolTip="下一页" 
                                CssClass="pageturn-next-b" onclick="Pager_Click" CommandName="+" />
                            <asp:Button ID="Button_Pager_Last" UseSubmitBehavior="false" runat="server" Text="" ToolTip="末页" 
                                CssClass="pageturn-last-b" onclick="Pager_Click" CommandName="++" /><asp:Label ID="Label9" runat="server"></asp:Label><input type="button" class="page-split" disabled />
                        </td>
                        <td class="pagebar" align="right">
                            <asp:Label ID="Label_Total" runat="server"></asp:Label>
                        </td>
                    </tr>
               </table>

            </td>
        </tr>
    </table>
    

</div>
</div>

</form>
<script>
    var ghlist = document.getElementById("GongHuo1");
    ghlist.style.display = "none";
    var textboxs = document.getElementsByTagName("input");
    var i;
    for (i = 0; i < textboxs.length; i++) {
        if (textboxs[i].className == "textbox") {
            //textboxs[i].onchange = function(e) { this.className = "textbox-changed"; };
            textboxs[i].onfocus = function(e) { this.select(); };
        }
        else if (textboxs[i].className == "pageturn" || textboxs[i].className == "intxt1" || textboxs[i].className == "intxt2") {
            textboxs[i].onfocus = function(e) { this.select(); };
        }
    }
    var rows = document.getElementsByTagName("tr");
    for (i = 0; i < rows.length; i++) {

        if (rows[i].className == "grid-row-normal") {
            rows[i].onmouseover = function() { this.className = "grid-row-bright"; };
            rows[i].onmouseout = function() { this.className = "grid-row-normal"; };
            rows[i].onclick = selectRow;
        }
        else if (rows[i].className == "grid-row-selected") {
        //rows[i].onclick = function() { parent.swin_load('/JiDong/设备登记.aspx?id=<%=this.SelectedID.Text %>'); }; 
        }
    }
    var tds = document.getElementsByTagName("td");
    for (i = 0; i < tds.length; i++) {
        if (tds[i].className == "detailheader") {
            tds[i].innerHTML = tds[i].innerHTML.replace("*", "<span class=required>*</span>");
        }
    }

    var id = "<%=this.SelectedID.Text %>";

    document.onkeydown = function(e) {
        if (!e) e = window.event;
        var tag = e.srcElement;
        if (!tag) tag = e.target;
        if (tag.tagName != "INPUT" || tag.className != "textbox") return;
        if (e.keyCode == 13) e.keyCode = 9;
    }
    parent.hidesubmenu(true);
</script>
</body>
</html>
